<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* Redirect
*/
class Redirect extends MY_Controller
{
	
	function __construct()
	{
		parent::__construct();
	}

	function index() {

		$urlkey = urldecode($this->input->get('k'));
		$key = base64_decode($urlkey);

		$vdata = $this->cache->get(rtrim($key));
		logfile("[requestData]:".print_r($vdata,1),'requestData');
		if ($vdata['url'] && $vdata['data']) {

			$this->load->view('qdd/submit', $vdata);
		} else {

			echo "跳转网关失败<a href='javascript:;'>返回上一页</a>";
		}
	}

	// p2p接口用户测试
	function userTest() {

		// TODO register TEST
		$this->load->library('netcredit/loan');
		// $userinfo = array('realname' => '张恒'
		// 	            , 'aid'      => 3
		// 	            , 'mobile'   => '18868696122'
		// 	            , 'chinaid'  => '330724198903230010'
		// 	            , 'account'  => '18868696122');
		// var_dump($this->loan->_obj->register($userinfo));

		// TODO recharge
		// $data = array('aid' => 3, 'orderid' => time(), 'money' => 1000, 'other_account' => 'm118324'
		// 	      , 'bank_card' => '603367100134554589');
		// var_dump($this->loan->_obj->recharge($data));

		// TODO withdraw
		// $data = array('aid' => 3, 'orderid' => time(), 'money' => 100, 'other_account' => 'm118324'
		// 	      , 'bank_card' => '603367100134554589', 'bank_code' => '1', 'province_id' => '1', 'city_id' => '1001', 'fee' =>2);
		// var_dump($this->loan->_obj->withdraw($data));

		// TODO transfer
		// $data = array('aid' => 3, 'orderid' => time(), 'money' => 100, 'other_account' => 'm118324'
		// 	      , 'to_other_account' => 'p2102', 'pid' => '1', 'full_money' => 10000);
		// var_dump($this->loan->_obj->transfer($data));

		// TODO transferaudit
		// $data = array('aid' => 3, 'orderid' => time(), 'pay_audit' => 1, 'request_nos' => array('LN62015071707191532015684634'));
		// var_dump($this->loan->_obj->transferaudit($data));

		// TODO getCity
		// var_dump($this->loan->_obj->getCity(1002));

		// TODO banks

	}

	public function returnUrl() {

		var_dump($_POST);
	}

}